<script language="javascript">
    // apply filters
    var applyFilter = jQuery(document).ready(function(){
    	semanaFiltro = document.getElementById("filtrosema").value;
        jQuery("#list").jqGrid({
            url: '<?php echo site_url() ?>/indicadoresgproduccion/data/'+semanaFiltro+'/',
            mtype: 'POST',
            datatype: 'json',
            colNames:['ID','Referencia', 'Tipo','C. Servicio','Registro','D.U.','Etapa A.','Etapa',
                      'Total','User','Responsable'],
                      colModel :[
                          {name:'IdCompania', index:'IdCompania', width:5,hidden:true},
                          {name:'NombreCompania', index:'NombreCompania', width:60},
                          {name:'IdServicio', index:'IdServicio', width:35},
                          {name:'cServicio', index:'clasificacion_servicios', width:25},
                      	  {name:'FechaUsrCompania', index:'FechaUsrCompania', width:30},
                      	  {name:'dias', index:'NombreCompania', width:15},
                      	  {name:'IdEtapa',index:'idStatu',width:25},
                      	  {name:'Etapa', index:'Etapa', width:20},
                      	  {name:'Total', index:'Total', width:20},
                      	  {name:'User', index:'IdUsuario', width:25},
                      	  {name:'Responsable', index:'Responsable', width:35}],
            pager: jQuery('#pager'),
            hiddengrid: true,
            sortname: 'IdCompania',
            rowNum:30,       
            rowList:[30,40,50,60,70],
            sortorder: "DESC",
            height: '100%',
            width: '890',
            imgpath: _base_url + 'public/css/jqgrid/flex/images',
            viewrecords: true,
            multiselect: false,
            onSelectRow: function(ids) 
            {
            	if(ids != null) 
            	{
            		var rec = jQuery("#list").getRowData(ids);
            		lol=ids;
            	}
            	
            },
            adjacents: 5,
            jsonReader: { repeatitems : false, IdCompania: "0" }
        }).navGrid('#pager',{add:false,del:false,edit:false,search:false,position:"left"})
        
         .navButtonAdd('#pager',{caption:"", buttonimg: _base_url + "public/css/jqgrid/flex/images/text_columns.png", onClickButton:function(){ jQuery("#list").setColumns();} })
         
         $('#apply_filter').bind('click', applyFilter);
        
	});
  
</script>
<div class="table_container">
<form action="indicadoresgproduccion" name="commentForm" method="post"/>
<table>
<?php 
  $semanaFiltro = $this->session->userdata('semAc');
?>
<tr>
<td>
<?php echo form_open("indicadoresgproduccion", array('name' => 'commentForm','id' => 'commentForm'));?> 
  Semanas:<select name="filtrosema" id = "filtrosema" >
           <option value="9"  <?php if ($semanaFiltro == 9):?>selected="selected"<?php endif;?>>10</option>
           <option value="15" <?php if ($semanaFiltro == 15):?>selected="selected"<?php endif;?>>16</option>
           <option value="25" <?php if ($semanaFiltro == 25):?>selected="selected"<?php endif;?>>26</option>
           <option value="51" <?php if ($semanaFiltro == 51):?>selected="selected"<?php endif;?>>52</option>
 </select>
 
 <input type="submit" value="Buscar"/><br/>

 <?php if($this->session->userdata('semAc')){?>
		
 	  						<b style="color:blue">Semana:</b>
                            <b style="color:red"><?php echo "El numero de Semana es: ".$semanaFiltro+=1; ?></b>
 
 <?php  }?>
  </td>
 	</tr>
	 </form>
	 
    <tr>
    	<td><div id="titulo">Lista de Compa&ntilde;ias mas viejas en Producci&oacute;n</div></td>
    </tr>
   
	 <tr>
        <td>
            <table id="list" class="scroll"></table>
            <div id="pager" class="scroll" style="text-align:center;"></div>
        </td>
	</tr>
 </table>
 
 <table>
 	<tr>
 		<td colspan="2"><?php echo $diasCamaraDgii;?></td>
 	</tr>
 	<tr>
 		<td>
 		<?php echo $diasRetrazados;?>
 		<?php $this->load->view('detallediasretrazo_list', $detalle_dias)?>
 		</td>
 		<td><?php echo $situacion;?></td>
 		</tr>
 	
 	<tr>
 		<td><?php echo $promedioSemana;?>
 		<?php $this->load->view('efectividadview_list', $detalles_efecti)?>
 		</td>
 		
 		<td><?php echo $promedio;?></td>
 	</tr>
 </table>
 		
</div>
